package com.sztz.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sztz.entity.Role;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 角色信息Mapper
 * @author yzy
 * @date 2023/3/23 10:03
 */
@Mapper
public interface RoleMapper extends BaseMapper<Role> {
    /***
     * 根据用户ID查询出所有权限
     * @param userId 用户ID
     * @return java.util.List<com.tzcloud.entity.Role>
     * @author yzy
     * @date 2023/3/23 10:10
     */
    @Select("select * from t_role where id in (select role_id from t_user_role where user_id = #{userId}) and status=1 and deleted=0")
    List<Role> selectByUserId(@Param("userId") int userId);
}
